#!/usr/bin/env python
# encoding: utf-8

import os

Import('env')
Import('VERSION_MAJOR')
Import('VERSION_MINOR')
Import('VERSION_PATCH')
Import('VERSION_NAME')
Import('create_uninstall_target')
Import('library')

programs = []
for progname in ['rmlint']:
    print("Building " + progname)
    program = env.Program(
        '../' + progname, [progname + '.c', library]
    )

    env.Depends(program, [library])
    programs.append(program)

    if 'uninstall' in COMMAND_LINE_TARGETS:
        create_uninstall_target(env, "$PREFIX/bin/" + progname)


if 'install' in COMMAND_LINE_TARGETS:
    env.Alias(
        'install',
        env.InstallPerm('$PREFIX/bin', programs, int("755", 8))
    )


env.Default(programs)
Return('programs')
